package com.chennan.book.domain.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

/**
 * @author chennan
 * @create 2022-02
 */
@Configuration
public class ExecutorServiceConfig {



    @Bean
    public ExecutorService getThreadPoolExecutor(){
        BlockingQueue<Runnable> bq=new ArrayBlockingQueue<Runnable>(2000);
        ExecutorService service=new ThreadPoolExecutor(5, 10, 3000, TimeUnit.MILLISECONDS, bq,new ThreadPoolExecutor.AbortPolicy());
        return service;
    }

}
